package com.cloudsigns.factorymanager2.operate_maintain.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OpearteMaintainCompleteCheckListActivity;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OperateMaintainDeviceBingingListActivity;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OperateMaintainEvaluationRecirdListActivity;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OperateMaintainImportantMattersListActivity;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OperateMaintainMaterialsRecipientsListActivity;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OperateMaintainOnDutyFragmentActivity;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OperateMaintainOrderManagementListActivity;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OperateMaintainQueryActivity;
import com.cloudsigns.factorymanager2.operate_maintain.activity.OperateMaintainRemindListActivity;

public class OperateMaintainManageFragment extends Fragment implements View.OnClickListener {
    private RelativeLayout rl_on_duty, rl_order_management, rl_important_matters, rl_device_binding, rl_complete_check, rl_materials_recipients, rl_query, rl_remind, rl_evaluation_record;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_operate_maintain_manage, null);
        rl_on_duty = view.findViewById(R.id.rl_on_duty);
        rl_order_management = view.findViewById(R.id.rl_order_management);
        rl_important_matters = view.findViewById(R.id.rl_important_matters);
        rl_device_binding = view.findViewById(R.id.rl_device_binding);
        rl_complete_check = view.findViewById(R.id.rl_complete_check);
        rl_materials_recipients = view.findViewById(R.id.rl_materials_recipients);
        rl_query = view.findViewById(R.id.rl_query);
        rl_remind = view.findViewById(R.id.rl_remind);
        rl_evaluation_record = view.findViewById(R.id.rl_evaluation_record);


        rl_on_duty.setOnClickListener(this);
        rl_order_management.setOnClickListener(this);
        rl_important_matters.setOnClickListener(this);
        rl_device_binding.setOnClickListener(this);
        rl_complete_check.setOnClickListener(this);
        rl_materials_recipients.setOnClickListener(this);
        rl_query.setOnClickListener(this);
        rl_remind.setOnClickListener(this);
        rl_evaluation_record.setOnClickListener(this);
        return view;
    }

    @Override
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            // 值班
            case R.id.rl_on_duty:
                intent = new Intent(getActivity(), OperateMaintainOnDutyFragmentActivity.class);
                startActivity(intent);
                break;
            // 工单管理
            case R.id.rl_order_management:
                intent = new Intent(getActivity(), OperateMaintainOrderManagementListActivity.class);
                startActivity(intent);
                break;
            // 重要事项
            case R.id.rl_important_matters:
                intent = new Intent(getActivity(), OperateMaintainImportantMattersListActivity.class);
                startActivity(intent);
                break;
            // 设备绑定
            case R.id.rl_device_binding:
                intent = new Intent(getActivity(), OperateMaintainDeviceBingingListActivity.class);
                startActivity(intent);
                break;
            // 竣工/验收
            case R.id.rl_complete_check:
                intent = new Intent(getActivity(), OpearteMaintainCompleteCheckListActivity.class);
                startActivity(intent);
                break;
            // 材料领用
            case R.id.rl_materials_recipients:
                intent = new Intent(getActivity(), OperateMaintainMaterialsRecipientsListActivity.class);
                startActivity(intent);
                break;
            // 查询
            case R.id.rl_query:
                intent = new Intent(getActivity(), OperateMaintainQueryActivity.class);
                startActivity(intent);
                break;
            // 提醒
            case R.id.rl_remind:
                intent = new Intent(getActivity(), OperateMaintainRemindListActivity.class);
                startActivity(intent);
                break;
            // 考评记录
            case R.id.rl_evaluation_record:
                intent = new Intent(getActivity(), OperateMaintainEvaluationRecirdListActivity.class);
                startActivity(intent);
                break;
        }
    }
}
